// +----------------------------------------------------------------------
// | Author: dw <827400818@qq.com>
// +----------------------------------------------------------------------
// | 系统设置js代码
// +----------------------------------------------------------------------
$(function(){
    layui.use(['element', 'form', 'laydate'], function () {
        var element = layui.element;
        var form    = layui.form;
        var laydate = layui.laydate;
        //时间选择器
        laydate.render({
            elem: '.back_time'
            , type: 'time'
        });
        //根据类型显示选择列表
        selectType(type);
        //监听radio
        form.on('radio(backup_type)', function (data) {
            selectType(data.value);
        });

        function selectType(type){
            if (type == 10) {
                $("#backup_week").hide();
                $("#backup_number").show();
            } else if (type == 20) {
                $("#backup_week").show();
                $("#backup_number").hide();
            } else if (type == 30) {
                $("#backup_week").hide();
                $("#backup_number").hide();
            }
        }
        // +----------------------------------------------------------------------
        // | 刷新
        // +----------------------------------------------------------------------
        $(".dw-refresh").click(function () {
            location.href = location.href;
        });
    });
})
